<%-- 
    Document   : register
    Created on : Mar 30, 2013, 6:58:42 PM
    Author     : DinhNP
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<link href="css/register.css" type="text/css" rel="stylesheet"/>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Đăng kí</title>
        <script type="text/javascript">
            function checkLogin(){
                if(sessionStorage.getItem('Username')!=null){
                    window.location.href = "homePage.jsp";
                }
            }
            
            function checkMinLength(){
                var item = document.getElementsByClassName('checkMin');
                for (var i=0;i<item.length;i++){
                    if (item[i].value.trim().length <5){
                        item[i].setAttribute('placeholder', 'Vui lòng nhập nhiều hơn 4 kí tự');
                        item[i].value='';
                        return false;
                    }
                }
                if (item[1].value != item[2].value){
                    item[2].setAttribute('placeholder', 'Vui lòng nhập lại mật khẩu!');
                    item[2].value='';
                    return false;
                }
            }
        </script>
    </head>
    <body>
        <script>
            checkLogin();
        </script>
        <!-- Include TOP  -->
        <%@include file="masterpage_top.jsp" %>

        <!-- MAIN CONTENT  -->
        <div id="middle">
            <div id="middle_content">
                <div id="left_content">
                    <div class="left_content_header" >ĐĂNG KÝ TÀI KHOẢN MỚI</div>
                    <div class="left_content_main">
                        <form id="register_form" onsubmit="return checkMinLength()" action="RegisterProcessing" method="POST">

                            <p>Tên tài khoản *</p>
                            <input type="text" name="txtUsername" placeholder="Tên tài khoản từ 5-15 kí tự" required maxlength="15" class="checkMin"/>

                            <p>Mật khẩu *</p>
                            <input type="password" name="txtPassword" placeholder="Mật khẩu từ 5-15 kí tự" required maxlength="15" class="checkMin"/>

                            <p>Xác nhận mật khẩu *</p>
                            <input type="password" name="txtConfirm" required maxlength="15" class="checkMin"/>

                            <p>Email *</p>
                            <input type="email" name="txtEmail" placeholder="example@abc.com" required maxlength="30" pattern="[^@]+@[^\.]+\..+"/><br/>

                            <button type="submit">Đăng kí</button>
                            <button type="reset">Nhập lại</button>
                        </form>
                    </div><!-- end div.right_content_main -->
                </div><!-- end div.right_content -->
            </div><!-- end div#middle_content -->
        </div><!-- end div#middle -->

        <!-- Include BOTTOM  -->
        <%@include file="masterpage_bottom.jsp" %>
    </body>
</html>
